package sketchpad.gui.drawinggraph;

import sketchpad.constant.Config;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

//进行操作的基本单位
public class Group implements Serializable {

    private int id;
    private List<DrawItem> itemList;

    public Group(int i){
        id = i;
        itemList = new LinkedList<>();
    }

    public void add(DrawItem drawItem){
        drawItem.setGroupId(id);
        this.itemList.add(drawItem);
    }

    public void dismiss(){
         for (DrawItem item : itemList){
            item.setGroupId(Config.SELECT_ID);
        }
    }

    //Getter And Setter
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<DrawItem> getItemList() {
        return itemList;
    }
}
